/*
 * @Author: wxinlong 3075748076@qq.com
 * @Date: 2023-06-17 10:28:38
 * @LastEditors: wxinlong 3075748076@qq.com
 * @LastEditTime: 2023-06-17 10:54:41
 * @Description: 用户模型
 * Copyright (c) 2023 by wxinlong 3075748076@qq.com, All Rights Reserved.
 */
const { DataTypes, Model } = require('sequelize')
const sequelize = require('../config/database')

class User extends Model {}

User.init(
  {
    username: {
      comment: '用户名',
      type: DataTypes.STRING,
      allowNull: false,
      unique: true
    },
    password: {
      comment: '密码',
      type: DataTypes.STRING,
      allowNull: false
    },
    nickname: {
      comment: '昵称',
      type: DataTypes.STRING,
      allowNull: false
    },
    lastOnlineTime: {
      comment: '最后登陆时间',
      type: DataTypes.DATE,
      allowNull: true
    }
  },
  {
    sequelize,
    modelName: 'User'
  }
)

module.exports = User
